import request from '@/utils/request.js'

// 关注用户
export const addFollowAPI = target => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target
    }
  })
}
// 取消关注用户
export const deteleFollowAPI = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`
  })
}
// 收藏
export const addCollectAPI = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}

// 取消收藏
export const deteleCollectAPI = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${target}`
  })
}

// 对文章点赞
export const addLikeAPI = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}
// 对文章取消点赞
export const deteleLikeAPI = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/dislikes/${target}`
  })
}

// 获取用户个人资料
export const getUsersAPI = target => {
  return request({
    method: 'GET',
    url: '/v1_0/user/profile'
  })
}

// 修改用户个人资料
export const updataUsersAPI = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data
  })
}

// 修改用户个人资料头像
export const updataPhotoAPI = data => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data
  })
}
